package com.ss.android.update;

import android.content.Intent;
import android.net.Uri;
import android.view.View;
import java.io.File;

final class k implements View.OnClickListener {
    private final h d;
    private final boolean a;
    private final boolean b;
    private final UpdateHelper c;

    k(h arg1, boolean arg2, boolean arg3, UpdateHelper arg4) {
        this.d = arg1;
        this.a = arg2;
        this.b = arg3;
        this.c = arg4;

    }

    public final void onClick(View arg4) {
        if(!this.a || !this.b) {
            if((this.a) && !this.b) {
                this.d.a("forcible_accept");
            }else if(this.b) {
                this.d.a("downloaded_accept");
            }else {
                this.d.a("accept");
            }
        } else {
            this.d.a("forcible_downloaded_accept");
        }

        this.c.b();
        File v0 = this.c.r();
        if(v0 != null) {
            this.c.c();
            Intent v1 = new Intent("android.intent.action.VIEW");
            v1.setDataAndType(Uri.fromFile(v0), "application/vnd.android.package-archive");
            v1.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
            this.d.getContext().startActivity(v1);
        }
        else {
            this.c.t();
            if(this.a) {
                new h.h$a(this.d).start();
            }
        }

        if(!this.a) {
            this.d.dismiss();
        }
    }
}

